import axios from '@/libs/api.request.js'

export const findAllListHome = data =>{
  return axios.request({
    url: "/api/shop/product/findAllListHome",
    method: "get",
    data:data
  })
}

export const findAllList = data =>{
  return axios.request({
    url: "/api/shop/product/apilist",
    method: "get",
    data:data
  })
}

/** 查询商品类别列表 */
export const getCateGoryList = categoryType =>{
  return axios.request({
    url: "/api/shop/product/getCateGoryList/"+categoryType,
    method: "get",
  })
}
/** 根据商品类别查询商品列表 */
export const getProductByCateGory = cateGoryId =>{
  return axios.request({
    url: "/api/shop/product/getProductByCateGory/"+cateGoryId,
    method: "get",
  })
}

/** 查询家居建材类别列表 */
export const getBuildingCategorys = cateGoryId =>{
  return axios.request({
    url: "/api/shop/product/getSecondCateGory/"+cateGoryId,
    method: "get",
  })
}

/** 根据类别ID查询商品列表 */
export const selectProductByCateGory = cateGoryId =>{
  return axios.request({
    url: "/api/shop/product/selectProductByCateGory/"+cateGoryId,
    method: "get",
  })
}

/** 根据商品名称查询商品信息 */
export const selectProductByName = productName =>{
  return axios.request({
    url: "/api/shop/product/selectProductByName/"+productName,
    method: "get",
  })
}

/** 根据商品ID查询商品信息 */
export const selectProductById = productById =>{
  return axios.request({
    url: "/api/shop/product/getProductById/"+productById,
    method: "get",
  })
}

/** 根据品类类别查询商品信息 */
export const selectProductByCateGoryType = categoryType =>{
  return axios.request({
    url: "/api/shop/product/selectProductByCateGoryType/"+categoryType,
    method: "get",
  })
}

/** 根据供应商ID查询供应商信息 */
export const selectSupplierById = supplierId =>{
  return axios.request({
    url: "/api/shop/product/getSupplierById/"+supplierId,
    method: "get",
  })
}

/** 根据供应商ID查询商品信息 */
export const selectProductBySupplierId = supplierId =>{
  return axios.request({
    url: "/api/shop/product/selectProductBySupplierId/"+supplierId,
    method: "get",
  })
}

export const province = () =>{
  return axios.request({
    method:"get",
    url:"/api/provinces/province",
    data:""
  })
};


export const findByprovinceCode = (provinceCode) =>{
  return axios.request({
    method:"get",
    url:"/api/provinces/city/" + provinceCode,
    data:""
  })
};

export const findBycityCode = (cityCode) =>{
  return axios.request({
    method:"get",
    url:"/api/provinces/town/" + cityCode,
    data:""
  })
};

// 根据商品ID查询商品的规格信息
export const selectProductLableByProId = productId =>{
  return axios.request({
    method:"get",
    url:"/api/shop/product/selectProductLableByProId/" + productId,
  })
};

// 根据规格ID查询商品的规格信息
export const selectProductLableByLableId = productLableId =>{
  return axios.request({
    method:"get",
    url:"/api/shop/product/selectProductLableByLableId/" + productLableId,
  })
};

// 查询店铺的优惠券
export const selectSupplierCoupon = supplierId =>{
  return axios.request({
    method:"get",
    url:"/api/shop/product/selectSupplierCoupon/" + supplierId,
  })
};

//根据商品id查询规格图片轮播
export const selectPpiUrl = productId =>{
  return axios.request({
    method:"post",
    url:"/api/shop/product/selectPpiUrl/" + productId,
  })
};

// 上传营业执照
export const uploadLicense = data =>{
  return axios.request({
    url: "/api/shop/product/uploadLicense",
    method: "post",
    data:data
  })
};

// 上传资质证书
export const uploadCertificate = data =>{
  return axios.request({
    url: "/api/shop/product/uploadCertificate",
    method: "post",
    data:data
  })
};

// 上传企业logo
export const uploadSupplierPic = data =>{
  return axios.request({
    url: "/api/shop/product/uploadSupplierPic",
    method: "post",
    data:data
  })
};

// 申请入驻
export const installSupplier = data =>{
  return axios.request({
    url: "/api/shop/product/installSupplier",
    method: "post",
    data:data
  })
};





//添加购物车
export const saveShopping = data =>{
  return axios.request({
    method:"post",
    url:"/api/shop/product/saveShopping",
    data:data
  })
};


